Repository navigation
Conversation
Set Paragraph Formatting (the Paragraph dialog's OK) set the indents in points but left a paragraph's w:firstLineChars (or its style's), which win in Word and in the layout, so a first line set to 2.5 cm in a WPS document stayed four characters. It now cancels them, as Word writes w:firstLineChars=0, for the indents it sets in points and only where the paragraph has indents in characters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
What
Paragraphs can carry an indent in characters (
w:firstLineChars,w:leftChars,w:rightChars,w:hangingChars) beside the same indent in twips. When both are there, the characters win, in Word and in WordCraft's layout. Documents saved by WPS often have both, for examplew:firstLineChars="400" w:firstLine="1417".The Paragraph dialog's OK (
para.set) set the indents in points and left the characters in place. Setting a first line of 2.5 cm on such a paragraph wrotew:firstLine="1417", but the paragraph kept its 4 characters, on the page and after a save. To the user, the dialog seemed to forget the value.The other indent commands already handle this.
para.indents(the ruler), Increase/Decrease Indent, Tab at the start of a paragraph, Backspace and the hanging indent shortcuts all callParaProps::cancel_char_indents. Onlypara.setdidn't.The change
set_propsnow cancels the indents in characters for each indent it sets in points: left, right and first line, frompropsor fromonPage. It skips one whenpropsalso gives that indent in characters. As incancel_line_spacing, it changes only paragraphs where the resolved value (the paragraph's own or its style's) is non-zero. Paragraphs without indents in characters aren't touched, so nothing extra is written for them.Testing
para_set_indents_in_points_win_over_indents_in_characterscovers a paragraph with 4 characters beside 70.85 pt set to 2.5 cm, a paragraph without characters, a style'sindentLeftCharsoverridden throughonPage, and characters given along with the points. It fails with the fix taken out.fmt,clippyfor the engine, and the tests for engine, docx and layout pass locally on Windows, on top ofmain2922fe5.kittestcase, not included), so the dialog side wasn't the cause.Overlaps
styles.modify, for the Modify Style dialog. It doesn't touchpara.set, so the two don't overlap.set_props, to cancel spacing in lines, not indents. It's a different part of the function, though the two may need a small merge.🤖 Generated with Claude Code
Summary by CodeRabbit